package com.cherish.meeting.db.entity;

import lombok.Data;
import org.springframework.util.StringUtils;

import java.io.Serializable;

/**
 * <p>
 *
 * </p>
 *
 * @author admin
 * @since 2021-03-02
 */
public class UserInfo implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * id
     */
    private Long id;

    /**
     * openid
     */
    private String openid;

    /**
     * 姓名
     */
    private String name;

    /**
     * 联系方式
     */
    private String mobile;

    /**
     * 头像
     */
    private String icon;

    /**
     * 昵称
     */
    private String nickname;

    public Long getId() {
        return id;
    }

    public UserInfo setId(Long id) {
        this.id = id;
        return this;
    }

    public String getOpenid() {
        return openid;
    }

    public UserInfo setOpenid(String openid) {
        this.openid = openid;
        return this;
    }

    public String getName() {
        return name;
    }

    public UserInfo setName(String name) {
        this.name = name;
        return this;
    }

    public String getMobile() {
        return mobile;
    }

    public UserInfo setMobile(String mobile) {
        this.mobile = mobile;
        return this;
    }

    public String getIcon() {
        return icon;
    }

    public UserInfo setIcon(String icon) {
        this.icon = icon;
        return this;
    }

    public String getNickname() {
        return nickname;
    }

    public UserInfo setNickname(String nickname) {
        this.nickname = nickname;
        return this;
    }

    public boolean isSameTo(UserInfo userInfo) {
        if (StringUtils.isEmpty(userInfo.getOpenid())
                || StringUtils.isEmpty(userInfo.getName())
                || StringUtils.isEmpty(userInfo.getMobile())) {
            return false;
        }
        if (StringUtils.isEmpty(this.getOpenid())
                || StringUtils.isEmpty(this.getName())
                || StringUtils.isEmpty(this.getMobile())) {
            return false;
        }
        if (this.getOpenid().equals(userInfo.getOpenid())
                && this.getName().equals(userInfo.getName())
                && this.getMobile().equals(userInfo.getMobile())) {
            return true;
        }
        return false;
    }

}
